package earogya.ehr.patient_details.ws;
import java.io.IOException;

import ca.uhn.hl7v2.HL7Exception;
import earogya.ehr.patient_details.*;


public class EHRPatientDetailsServiceInterface {
	
	public String handlePatientDetailsMessage(String msg)throws HL7Exception, IOException{
		/*String msgA04="MSH|^~\\&|GUI|CSTH|EHR|CSTH|20110603||ADT^A04||P|2.5.1\r"
			+"EVN|A04|20030822172800|||1\r"
			+"PID|||866461694V||Wijekoon^Ureka Sanjeewani^^Ms||19860525|F||Sinhalese|&Galle Rd&234^Moratuwa^Colombo^^^Sri Lanka||(+94)772515092^^^ureka@gmail.com|||S|3|||||5|Kurunegala|0||||||0|\r"
			+"PD1||2||||||3|\r"
			+"DB1||||4|19970623|19990622|\r"
			+"AL1|||AA|N||20091011|";
		String msgA08="MSH|^~\\&|GUI|CSTH|EHR|CSTH|20110603||ADT^A08||P|2.5.1\r"
			+"EVN|A08|20030822172800|||1\r"
			+"PID||56|00001122V||||||||^Katubedda^^^^|||||||\r"
			+"PD1||||||||5|\r"
			+"DB1|||SS|D||19990622|";
		String msgA60="MSH|^~\\&|GUI|CSTH|EHR|CSTH|20110603||ADT^A60||P|2.5.1\r"
			+"EVN|A60|20030822172800|||1\r"
			+"PID|1|\r"
			+"IAM|||AAAA|D|||||||||20110524124533|"
			+"IAM|||CCC|N|||||||||20110602112233|";
		
		String msgQRYA19="MSH|^~\\&|KIS||CommServer||200811111017||QRY^A19||P|2.5.1|\r"
							+"QRD|200811111016|R|I|Q1004|||1^RD|866461694V|DEM|||";*/
		HL7MessageHandler h=new HL7MessageHandler();
		String ack=h.parser(this.modifyMessage(msg));
		return ack;
	}
	
	private String modifyMessage(String message){
		String newMessage=null;
		newMessage=message.replaceAll("\n", "\r");
		return newMessage;
	}	
}
